<%--
    author:xuzm
    date:20180419
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<link type="text/css" rel="stylesheet" href="css/orderChange/orderChange.css"/>
<link type="text/css" rel="stylesheet" href="css/common/common.css"/>
<!-- Main view -->
<div class="animated fadeInRight">
    <div class="wrapper wrapper-content ng-scope">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>{{ 'REFUND_QUERY' | translate }}</h5>
                    </div>
                    <div class="ibox-content sk-loading" ng-controller="orderChangeInfoCtrl">
                        <div class="sk-spinner sk-spinner-wave">
                            <div class="sk-rect1"></div>
                            <div class="sk-rect2"></div>
                            <div class="sk-rect3"></div>
                            <div class="sk-rect4"></div>
                            <div class="sk-rect5"></div>
                        </div>

                        <form name="myform" serializer="searchOrder(data)">
                            <div class="row">
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <div class="input-group-btn" uib-dropdown>
                                                <button class="btn btn-white btn-sm" style="margin-bottom: 0"
                                                        uib-dropdown-toggle type="button">
                                                    {{orderTypeTxt}}
                                                    <span class="caret"></span>
                                                </button>
                                                <ul uib-dropdown-menu>
                                                    <li><a href="" ng-click="orderSwitch($event, 'orderId')">平台订单号</a>
                                                    </li>
                                                    <li><a href=""
                                                           ng-click="orderSwitch($event, 'merOrderId')">商户订单号</a>
                                                    <li><a href=""
                                                           ng-click="orderSwitch($event, 'bankOrderId')">银行流水号</a>
                                                    </li>
                                                </ul>
                                            </div>
                                            <input type="hidden" id="exceptionType" name="exceptionType" value="1" ng-model="exceptionType" /> 
                                            <input uib-tooltip="可选择搜索：平台订单号、商户订单号、银行流水号"
                                                   type="text" id="orderId"
                                                   class="form-control" name="{{orderType}}" />
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">商户号：</span>
                                            <div uib-tooltip="可通过商户名称搜索商户号"
                                                 angucomplete-alt id="merId"
                                                 input-name="merId"
                                                 maxlength="10"
                                                 pause="100"
                                                 auto-match="true"
                                                 selected-object="selectedMerchant"
                                                 local-data="merchants"
                                                 search-fields="id,name"
                                                 title-field="id"
                                                 description-field="name"
                                                 minlength="0"
                                                 focus-first="true"
                                                 input-class="form-control form-control-small"
                                                 match-class="highlight">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">域名：</span>
                                            <div uib-tooltip="未选择商户请输入至少三位关键字，可直接输入商户号搜索域名，若商户不存在则不可输入！"
                                                 angucomplete-alt id="mer_web"
                                                 input-name="siteId"
                                                 maxlength="40"
                                                 pause="100"
                                                 auto-match="true"
                                                 selected-object="selectedWeb"
                                                 local-data="siteUrls"
                                                 search-fields="merId,siteUrl"
                                                 title-field="siteUrl"
                                                 description-field="merId"
                                                 minlength="minText"
                                                 focus-first="true"
                                                 input-class="form-control form-control-small"
                                                 match-class="highlight"
                                                 >
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">收单账户：</span>
                                            <select id="accountId" class="form-control" name="accountId">
                                                <option value=""></option>
                                                <option ng-repeat="x in acquirerAccounts" value="{{x.id}}">{{x.name}}
                                                </option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">申请人：</span>
                                            <input type="text" id="applicant" class="form-control" name="applicant">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">审核人：</span>
                                            <input type="text" id="auditor" class="form-control" name="auditor">
                                        </div>
                                    </div>
                                </div>
                                 <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">异常状态：</span>
                                            <select id="type" class="form-control" name="type">
                                                <option value=""></option>
                                                <option ng-repeat="obj in exceptionStatusList" ng-show="obj.firstValue == 2 || obj.firstValue == 3" value="{{obj.firstValue}}">
                                                    {{obj.name}}
                                                </option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">审核起始日期：</span>
                                            <input type="text" id="auditBeginDate" name="auditBeginDate"
                                                   uib-tooltip="可只选择起始日期查询起始日期至今订单"
                                                   class="form-control" ng-readonly="true" ng-click="openDatepicker1()"
                                                   uib-datepicker-popup="{{format}}" ng-model="auditBeginDate"
                                                   is-open="popup1.opend"
                                                   datepicker-options="dateOptions1"
                                                   close-text="Close" alt-input-formats="altInputFormats"
                                                   close-text="关闭" clear-text="清空" current-text="今天">
                                            <span class="input-group-btn">
                                            <button type="button" class="btn btn-default btn-sm no-margins"
                                                    ng-click="openDatepicker1()">
                                                <i class="fa fa-calendar"></i>
                                            </button>
                                        </span>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">审核结束日期：</span>
                                            <input type="text" id="auditEndDate" name="auditEndDate"
                                                   class="form-control" ng-readonly="true" ng-click="openDatepicker2()"
                                                   uib-datepicker-popup="{{format}}" ng-model="auditEndDate"
                                                   is-open="popup2.opend"
                                                   datepicker-options="dateOptions2"
                                                   close-text="Close" alt-input-formats="altInputFormats"
                                                   ng-disabled="auditEndDateDisable"
                                                   close-text="关闭" clear-text="清空" current-text="今天">
                                            <span class="input-group-btn">
                                            <button type="button" class="btn btn-default btn-sm no-margins"
                                                    ng-click="openDatepicker2()"
                                                    ng-disabled="auditEndDateDisable">
                                                <i class="fa fa-calendar"></i>
                                            </button>
                                        </span>
                                        </div>
                                    </div>
                                </div>

                            </div>
                            <div class="row">
                                <div class="col-sm-6 col-md-6 col-lg-3 col-lg-offset-3">
                                    <button type="submit" class="btn btn-sm btn-w-m btn-primary pull-right general-btn">
                                                                                                                                              查询
                                    </button>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-3">
                                    <button type="button" class="btn btn-sm btn-w-m btn-info general-btn"
                                            ng-click="resetForm()">
                                            
                                                                                                                                                重置
                                                                                                                                                
                                    </button>
                                </div>
                                <div class="pull-right col-sm-6 col-md-6 col-lg-3">
                                    <button type="button" class="pull-right btn btn-sm btn-sm btn-success export-btn"
                                            ng-click="exportCsv()">
                                        <i class="fa fa-download"></i>&nbsp;导出数据
                                    </button>
                                </div>
                            </div>
                        </form>
                        <div class="hr-line-dashed"></div>
                        <div class="table-responsive">
                            <table class="table table-condensed table-striped table-hover table-bordered">
                                <tr>
                                    <th class="text-center">退款笔数</th>
                                    <th class="text-center">退款金额</th>
                                </tr>
                                <tr ng-repeat="obj in orderChangeStatistics" >
                                    <td class="text-center">{{obj.orderChangeNum}}</td>
                                    <td class="text-center">{{obj.orderChangeRmbAmount}}</td>
                                </tr>
                            </table>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <%-- ng_table --%>
                        <div class="table-responsive">
                            <table ng-table="orderChangeTable"
                                   class="table orderChangetable table-condensed table-striped table-hover table-bordered">
                                <tr ng-repeat="row in $data">
                                    <td class="text-center" data-title="'平台订单号'"
                                        sortable="'orderId'">
                                        {{row.orderId}}
                                    </td>
                                    <td class="text-center" data-title="'商户号'">
                                         {{row.merId}}
                                    </td>
                                    <td class="text-center" data-title="'商户名称'">
                                        {{row.merName}}
                                    </td>
                                    <td class="text-center" data-title="'域名'">
                                        {{row.siteUrl}}
                                    </td>
                                    <td class="text-center" data-title="'商户订单号'">
                                         {{row.merOrderId}}
                                    </td>
                                    <td class="text-center"  data-title="'收单账户'">
                                        {{row.aquireAccountName}}
                                    </td>
                                    <td class="text-center" data-title="'异常状态'">
										{{row.type | enumParamsFilter:[{2:"全额退款",3:"部分退款"}]}}
                                    </td>
                                    <td class="text-center" data-title="'订单金额'">
                                       {{row.sourceAmount | currency:row.currency}}
                                    </td>
                                    <td class="text-center" data-title="'订单金额CNY'">
                                         {{row.sourceRmbAmount | currency:'¥'}}
                                    </td>
                                    <td class="text-center" data-title="'交易时间'">
                                        {{row.tradeTime | date:'yyyy/MM/dd hh:mm'}}
                                    </td>
                                    <td class="text-center"  data-title="'退款金额'">
                                       {{row.amount | currency:row.currency}}
                                    </td>
                                    <td class="text-center" data-title="'退款金额CNY'">
                                         {{row.rmbAmount | currency:'¥'}}
                                    </td>
                                    <td class="text-center" data-title="'退款手续费'">
                                        {{row.fee}}
                                    </td>
                                    <td class="text-center" data-title="'归还手续费'">
                                        {{row.returnFee}}
                                    </td>
                                    <td class="text-center" data-title="'申请人'">
                                        {{row.applicant}}
                                    </td>
                                    <td class="text-center" data-title="'申请时间'">
                                       {{row.applicationTime | date:'yyyy/MM/dd hh:mm'}}
                                    </td>
                                    <td class="text-center" data-title="'申请理由'">
                                        {{row.reasons}}
                                    </td>
                                    <td class="text-center" data-title="'审核人'">
                                        {{row.auditor}}
                                    </td>
                                    <td class="text-center" data-title="'审核时间'">
                                        {{row.auditTime | date:'yyyy/MM/dd hh:mm'}}
                                    </td>
                                    <td class="text-center" data-title="'审核结果'">
										{{row.status | enumParamsFilter:[{1:"已通过"}]}}
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <my-pagination table-param="orderChangeTable"></my-pagination>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>